package cn.platform.response;

import lombok.Data;

@Data
public class ResultStudent<T> {
    private Integer code; //编码：1成功，0为失败
    private String msg;   //错误信息
    private T data;       //数据

    public static <T> ResultStudent<T> success() {
        ResultStudent<T> result = new ResultStudent<>();
        result.code = 1;
        result.msg = "success";
        return result;
    }

    public static <T> ResultStudent<T> success(T data) {
        ResultStudent<T> result = new ResultStudent<>();
        result.data = data;
        result.code = 1;
        result.msg = "success";
        return result;
    }

    public static <T> ResultStudent<T> error(String msg) {
        ResultStudent<T> result = new ResultStudent<>();
        result.code = 0;
        result.msg = msg;
        return result;
    }
}